package com.chixing.day02_switch_case;

public class MethodDemo {
    public static void main(String[] args) {
        int[] arr={5,3,2,1,6,4,4};
        quickSort(arr,0,arr.length-1);
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }

    //方法有返回值
    public static int add(int x, int y){
        int sum=x+y;
        return sum;
    }

    //获取电话号码
    public long getTelNo(){
        return 10;
    }


    /**
     * 快速排序
     */
    public static void quickSort(int[] arr,int low,int high){
        if(low <high){
            int i = low;
            int j = high;
            int temp = arr[low];
            while (i <j){
                while (i <j && arr[j]>temp)
                    j--;
                arr[i]=arr[j];
                while (i <j && arr[i]<=temp)
                    i++;
                arr[j]=arr[i];
            }
            arr[i]=temp;
            quickSort(arr,low,i-1);
            quickSort(arr,i+1,high);
        }else
            return;
    }
}
